<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<link rel="stylesheet" type="text/css"  href="css/admin.css"/>


</head>

<body>
<div id="login">
<h1>Inicio</h1>
<h2>Bienvenido a la seccion de Administracion</h2>
<?php
session_start();
if(!isset($_SESSION['username']))
{
	if($_SERVER['REQUEST_METHOD'] == 'POST'){		
		$username = $_POST["username"];
		$password = $_POST["password"];
		
		echo "DOCUMENT_ROOT ".$_SERVER['DOCUMENT_ROOT'];
		
		require("include/conection.php");
			
		$result = mysql_query("SELECT * FROM users WHERE username = '".$username."' AND password = '".$password."'");
		
		if(isset($_SESSION['username']))
			unset($_SESSION['username']);
		
		if (!$result) {
			die('Consulta inválida: ' . mysql_error());	
		}
		else 
		{
			while($row = mysql_fetch_array($result))
			{
				// store session data
				$_SESSION['username']=$row['username'];	
			}
				
		}
		mysql_close($con);
	}		
} 

require("include/user-info.php");

?>

</div>
</body>
</html>